//
//  LTFindNewHuoDongTableViewCell.m
//  UIA_ximalaya
//
//  Created by Lee on 15/12/10.
//  Copyright © 2015年 lite. All rights reserved.
//

#import "LTWebViewTableViewCell.h"

@implementation LTWebViewTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createview];
    }
    return self;
    
}
- (void)createview{
    self.imageview = [[UIImageView alloc] initWithFrame:CGRectZero];
   // _imageview.backgroundColor = [UIColor redColor];
    
    self.backview = [[UIImageView alloc] initWithFrame:CGRectZero];
    _backview.image = [UIImage imageNamed:@"backgroud"];
    
    self.title = [[UILabel alloc] initWithFrame:CGRectZero];
    self.title.textColor = [UIColor whiteColor];
    _title.font = [UIFont boldSystemFontOfSize:21];
//   _title.backgroundColor = [UIColor purpleColor];
    _title.textAlignment = NSTextAlignmentCenter;
    
    self.smalltitle = [[UILabel alloc] initWithFrame:CGRectZero];
    _smalltitle.textColor = [UIColor whiteColor];
    _smalltitle.font = [UIFont systemFontOfSize:13];
    self.backgroundColor = [UIColor colorWithRed:1 green:0.95 blue:0.78 alpha:1];
    _smalltitle.textAlignment = NSTextAlignmentCenter;
    self.backgroundColor = [UIColor whiteColor];
    [self addSubview:self.imageview];
    [self.imageview addSubview:self.backview];
    [self addSubview:self.title];
    [self addSubview:self.smalltitle];

    
}

- (void)layoutSubviews{
    [super layoutSubviews];
    _imageview.frame = CGRectMake(10, 10, self.frame.size.width-20, self.frame.size.height-10);
    _imageview.layer.masksToBounds = YES;
    _imageview.layer.cornerRadius = 5*XWIDTH;
    _backview.frame = CGRectMake(-10, 0, self.frame.size.width, self.frame.size.height-10);
    _title.frame = CGRectMake(10, 80*XHIGHT, self.width, 30*XHIGHT);
    _smalltitle.frame = CGRectMake(0, _title.bottom+10, self.width, 30*XHIGHT);
    
}
- (void)setModel:(RecommendSecondModel *)model {
    if (_model != model) {
        _model = model;
    }
    [_imageview sd_setImageWithURL:[NSURL URLWithString:_model.cover] placeholderImage:[UIImage imageNamed:@"160.jpg"]];
    _title.text = _model.title;
    _smalltitle.text = [NSString stringWithFormat:@"[ %@ ]", _model.sub_title];
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
